var sources = require('./../lib/source');
var getitem = require('./../lib/sourceitem')(sources);
module.exports = function (UC, source, config, ArFor, cache, package) {
    var UserControl = UC;
    var router = function (req, res, next) {
        var login = false;

        if (req.UserAgent == null) {
            req.UserAgent = {}
        }
        req.UserAgent.isMobile = true;


        new source(getitem('W_26'), {}, function (website) {

            var manifest_id = cache.GetTemplateID(package.id + '/mobile');

            var File = cache.GetTemplateID(package.id + '/' + website.id + "/mobile/home") + '.html';

            cache.render({
                id: package.id,
                file: './jview/index'
            }, {
                title: website.name,
                icon: website.icon,
                style: website.style,
                sys_id: package.id,
                manifest_id: manifest_id,
                login: login,
                version: package.version + '.' + config.id + "." + config.version,
                category: [],
                UserAgent: req.UserAgent,
                CarouselList: [],
                NoticeBoard: [],
                ImageList: [],
                PageType: 'home',
                CategoryList: []
            }, req, res, File);
        })

    };
    return router;
};